home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / taropyon / splib / splib.lzh / PRG / ZMODEM / ZMODEM.H < prev    next >
Text File  |  1993-06-28  |  7KB  |  145 lines

  1. /*
  2.  * Z M O D E M . H       Manifest constants for ZMODEM application to
  3.  * application file transfer protocol 04-17-89    Chuck Forsberg Omen
  4.  * Technology Inc
  5.  */
  6. #define ZPAD '*'                /* 052 Padding character begins frames */
  7. #define ZDLE 030                /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
  8. #define ZDLEE (ZDLE^0100)        /* Escaped ZDLE as transmitted */
  9. #define ZBIN 'A'                /* Binary frame indicator (CRC-16) */
  10. #define ZHEX 'B'                /* HEX frame indicator */
  11. #define ZBIN32 'C'                /* Binary frame with 32 bit FCS */
  12. #define ZBINR32 'D'             /* RLE packed Binary frame with 32 bit FCS */
  13. #define ZVBIN 'a'                /* Binary frame indicator (CRC-16) */
  14. #define ZVHEX 'b'                /* HEX frame indicator */
  15. #define ZVBIN32 'c'             /* Binary frame with 32 bit FCS */
  16. #define ZVBINR32 'd'            /* RLE packed Binary frame with 32 bit FCS */
  17. #define ZRESC    0176            /* RLE flag/escape character */
  18. #define ZMAXHLEN 16             /* Max header information length  NEVER
  19.                                  * CHANGE */
  20. #define ZMAXSPLEN 1024            /* Max subpacket length  NEVER CHANGE */
  21.  
  22. /* Frame types (see array "frametypes" in zm.c) */
  23. #define ZRQINIT 0                /* Request receive init */
  24. #define ZRINIT    1                /* Receive init */
  25. #define ZSINIT 2                /* Send init sequence (optional) */
  26. #define ZACK 3                    /* ACK to above */
  27. #define ZFILE 4                 /* File name from sender */
  28. #define ZSKIP 5                 /* To sender: skip this file */
  29. #define ZNAK 6                    /* Last packet was garbled */
  30. #define ZABORT 7                /* Abort batch transfers */
  31. #define ZFIN 8                    /* Finish session */
  32. #define ZRPOS 9                 /* Resume data trans at this position */
  33. #define ZDATA 10                /* Data packet(s) follow */
  34. #define ZEOF 11                 /* End of file */
  35. #define ZFERR 12                /* Fatal Read or Write error Detected */
  36. #define ZCRC 13                 /* Request for file CRC and response */
  37. #define ZCHALLENGE 14            /* Receiver's Challenge */
  38. #define ZCOMPL 15                /* Request is complete */
  39. #define ZCAN 16                 /* Other end canned session with CAN*5 */
  40. #define ZFREECNT 17             /* Request for free bytes on filesystem */
  41. #define ZCOMMAND 18             /* Command from sending program */
  42. #define ZSTDERR 19                /* Output to standard error, data follows */
  43.  
  44. /* ZDLE sequences */
  45. #define ZCRCE 'h'                /* CRC next, frame ends, header packet
  46.                                  * follows */
  47. #define ZCRCG 'i'                /* CRC next, frame continues nonstop */
  48. #define ZCRCQ 'j'                /* CRC next, frame continues, ZACK expected */
  49. #define ZCRCW 'k'                /* CRC next, ZACK expected, end of frame */
  50. #define ZRUB0 'l'                /* Translate to rubout 0177 */
  51. #define ZRUB1 'm'                /* Translate to rubout 0377 */
  52.  
  53. /* zdlread return values (internal) */
  54. /* -1 is general error, -2 is timeout */
  55. #define GOTOR 0400
  56. #define GOTCRCE (ZCRCE|GOTOR)    /* ZDLE-ZCRCE received */
  57. #define GOTCRCG (ZCRCG|GOTOR)    /* ZDLE-ZCRCG received */
  58. #define GOTCRCQ (ZCRCQ|GOTOR)    /* ZDLE-ZCRCQ received */
  59. #define GOTCRCW (ZCRCW|GOTOR)    /* ZDLE-ZCRCW received */
  60. #define GOTCAN    (GOTOR|030)     /* CAN*5 seen */
  61.  
  62. /* Byte positions within header array */
  63. #define ZF0     3                /* First flags byte */
  64. #define ZF1     2
  65. #define ZF2     1
  66. #define ZF3     0
  67. #define ZP0     0                /* Low order 8 bits of position */
  68. #define ZP1     1
  69. #define ZP2     2
  70. #define ZP3     3                /* High order 8 bits of file position */
  71.  
  72. /* Bit Masks for ZRINIT flags byte ZF0 */
  73. #define CANFDX    01                /* Rx can send and receive true FDX */
  74. #define CANOVIO 02                /* Rx can receive data during disk I/O */
  75. #define CANBRK    04                /* Rx can send a break signal */
  76. #define CANRLE    010             /* Receiver can decode RLE */
  77. #define CANLZW    020             /* Receiver can uncompress */
  78. #define CANFC32 040             /* Receiver can use 32 bit Frame Check */
  79. #define ESCCTL 0100             /* Receiver expects ctl chars to be escaped */
  80. #define ESC8   0200             /* Receiver expects 8th bit to be escaped */
  81.  
  82. /* Bit Masks for ZRINIT flags byte ZF1 */
  83. #define CANVHDR 01                /* Variable headers OK */
  84.  
  85. /* Parameters for ZSINIT frame */
  86. #define ZATTNLEN 32             /* Max length of attention string */
  87. #define ALTCOFF ZF1             /* Offset to alternate canit string, 0 if not
  88.                                  * used */
  89. /* Bit Masks for ZSINIT flags byte ZF0 */
  90. #define TESCCTL 0100            /* Transmitter expects ctl chars to be
  91.                                  * escaped */
  92. #define TESC8    0200            /* Transmitter expects 8th bit to be escaped */
  93.  
  94. /* Parameters for ZFILE frame */
  95. /* Conversion options one of these in ZF0 */
  96. #define ZCBIN    1                /* Binary transfer - inhibit conversion */
  97. #define ZCNL    2                /* Convert NL to local end of line convention */
  98. #define ZCRESUM 3                /* Resume interrupted file transfer */
  99. /* Management include options, one of these ored in ZF1 */
  100. #define ZMSKNOLOC        0200    /* Skip file if not present at rx */
  101. /* Management options, one of these ored in ZF1 */
  102. #define ZMMASK    037             /* Mask for the choices below */
  103. #define ZMNEWL    1                /* Transfer if source newer or longer */
  104. #define ZMCRC    2                /* Transfer if different file CRC or length */
  105. #define ZMAPND    3                /* Append contents to existing file (if any) */
  106. #define ZMCLOB    4                /* Replace existing file */
  107. #define ZMNEW    5                /* Transfer if source newer */
  108. /* Number 5 is alive ... */
  109. #define ZMDIFF    6                /* Transfer if dates or lengths different */
  110. #define ZMPROT    7                /* Protect destination file */
  111. /* Transport options, one of these in ZF2 */
  112. #define ZTLZW    1                /* Lempel-Ziv compression */
  113. #define ZTRLE    3                /* Run Length encoding */
  114. /* Extended options for ZF3, bit encoded */
  115. #define ZXSPARS 64                /* Encoding for sparse file operations */
  116. #define ZCANVHDR        01        /* Variable headers OK */
  117. /* Receiver window size override */
  118. #define ZRWOVR 4                /* byte position for receive window
  119.                                  * override/256 */
  120.  
  121. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
  122. #define ZCACK1    1                /* Acknowledge, then do command */
  123.  
  124. long        rclhdr();
  125.  
  126. /* Globals used by ZMODEM functions */
  127. extern        Rxframeind;         /* ZBIN ZBIN32, or ZHEX type of frame */
  128. extern        Rxtype;             /* Type of header received */
  129. extern        Rxcount;            /* Count of data bytes received */
  130. extern        Rxtimeout;            /* Tenths of seconds to wait for something */
  131. extern long Rxpos;                /* Received file position */
  132. extern long Txpos;                /* Transmitted file position */
  133. extern        Txfcs32;            /* TURE means send binary frames with 32 bit
  134.                                  * FCS */
  135. extern        Crc32t;             /* Display flag indicating 32 bit CRC being
  136.                                  * sent */
  137. extern        Crc32;                /* Display flag indicating 32 bit CRC being
  138.                                  * received */
  139. extern        Znulls;             /* Number of nulls to send at beginning of
  140.                                  * ZDATA hdr */
  141. extern char Attn[ZATTNLEN + 1]; /* Attention string rx sends to tx on err */
  142. extern char *Altcan;            /* Alternate canit string */
  143.  
  144. /* End of ZMODEM.H */
  145.